package com.whccb.apps.office.document.at;

import org.apache.commons.lang.StringUtils;

import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.at.AbstExpression;
import com.actionsoft.bpms.commons.at.ExpressionContext;
import com.actionsoft.sdk.local.SDK;
import com.whccb.apps.office.document.util.DictUtil;

public class GetTxwjKmsCardName extends AbstExpression {
	public GetTxwjKmsCardName(ExpressionContext atContext,
			String expressionValue) {
		super(atContext, expressionValue);
	}

	public String execute(String expression) {
		String bindid = getParameter(expression, 1).trim();// 流程实例ID
		BO bo = SDK.getBOAPI().getByProcess("BO_WHBK_OD_INSTITUTION", bindid);
		String title = "";
		if (bo != null) {
			String reg_level_dict = bo.getString("REG_LEVEL_DICT");
			DictUtil dictUtil = new DictUtil();
			if (StringUtils.isNotEmpty(reg_level_dict)) {
				String fileTypeName = dictUtil.getDictValue(
						"WHBK.OD.GRC.FILE.TYPE", reg_level_dict);
				title = "<" + fileTypeName + ">";
			}
			if (StringUtils.isNotEmpty(bo.getString("FILE_NAME"))) {
				title = title + bo.getString("FILE_NAME");
			}
		}
		return title;
	}

}
